package com.scrumtrek.trainings.tdd;

import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 * User: msuprunov
 * Date: 21.02.13
 * Time: 11:06
 * To change this template use File | Settings | File Templates.
 */
public class StubStore implements IStore {
    private ArrayList<Item> items;

    public StubStore() {
        items = new ArrayList<Item>();
    }

    public int getCount() {
        return items.size();
    }

    public void addItem(Item item) {
        items.add(item);
    }

    public boolean existItem(Item item) {
        return items.indexOf(item) != -1;
    }

    public void sellItem(Item item) {
        int id = items.indexOf(item);
        if(id != -1){
            items.remove(id);
        }
    }
}
